import 'package:flutter/material.dart';
import '../constants/colors.dart';
import '../constants/text_styles.dart';
import '../constants/spacing.dart';
import '../constants/dimensions.dart';

/// 统计卡片组件
///
/// 用于显示上传统计信息
class StatCard extends StatelessWidget {
  /// 标题（如：全部、待挑等）
  final String title;

  /// 数值
  final int value;

  /// 单位（如：张）
  final String unit;

  const StatCard({
    super.key,
    required this.title,
    required this.value,
    required this.unit,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      width: double.infinity,
      padding: const EdgeInsets.all(AppSpacing.md),
      decoration: BoxDecoration(
        color: AppColors.cardBackgroundLight,
        borderRadius: BorderRadius.circular(AppDimensions.radiusMd),
        // 深色主题使用内阴影效果
        boxShadow: const [
          BoxShadow(
            color: AppColors.shadowInner,
            blurRadius: 4,
            offset: Offset(0, 2),
            spreadRadius: 0,
            blurStyle: BlurStyle.inner,
          ),
          BoxShadow(
            color: AppColors.shadowInnerBottom,
            blurRadius: 4,
            offset: Offset(0, -2),
            spreadRadius: 0,
            blurStyle: BlurStyle.inner,
          ),
        ],
      ),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Text(
            title,
            style: AppTextStyles.body2.copyWith(
              color: AppColors.textSecondary,
            ),
          ),
          const SizedBox(height: AppSpacing.sm),
          Row(
            crossAxisAlignment: CrossAxisAlignment.baseline,
            textBaseline: TextBaseline.alphabetic,
            children: [
              Text(
                value.toString(),
                style: AppTextStyles.heading1.copyWith(
                  color: AppColors.textPrimary,
                ),
              ),
              const SizedBox(width: AppSpacing.xs),
              Text(
                unit,
                style: AppTextStyles.body1.copyWith(
                  color: AppColors.textSecondary,
                ),
              ),
            ],
          ),
        ],
      ),
    );
  }
}
